package com.company;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

public class ruzhu {
    private JTextField textField1;
    private JTextField textField2;
    private JTextField textField3;
    private JTextField textField4;
    private JTextField textField6;
    private JTextField textField5;
    private JTextField textField7;
    private JTextField textField8;
    private JButton 入住Button;
    private JPanel panel1;

    public ruzhu() {
        JFrame ruz = new JFrame("入住情况");
        ruz.setSize(400, 400);
        ruz.add(panel1);
        ruz.setLocation(400,250);
        ruz.setVisible(true);
        入住Button.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                String[] STU=new String[8];
                STU[0]=textField1.getText();
                STU[1]=textField2.getText();
                STU[2]=textField3.getText();
                STU[3]=textField4.getText();
                STU[4]=textField5.getText();
                STU[5]=textField6.getText();
                STU[6]=textField7.getText();
                STU[7]=textField8.getText();
                ZSGC zs=new ZSGC();
                try {
                    zs.zengjia(STU);
                    JOptionPane.showConfirmDialog(null, "入住成功");
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }

            }
        });
    }
    public static void main(String[] args) {
        ruzhu ru=new ruzhu();
    }
}
